{{include file="public/header" /}}

<!-- right content start  -->
<div class="content-right">
	<div class="content">
		<!-- form start -->
		<form class="am-form form-validation am-form-pure am-form-full-screen am-form-popup-fixed" action="{{:MyUrl('admin/brand/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/brand/index', $params)}}" enctype="multipart/form-data">
			<legend>
				<span class="am-text-default">{{:MyLang('brand.base_nav_title')}}{{if empty($data['id'])}}{{:MyLang('created_title')}}{{else /}}{{:MyLang('edit_title')}}{{/if}}</span>
				<a href="{{:MyUrl('admin/brand/index', $params)}}" class="am-fr am-text-sm am-margin-top-sm am-icon-mail-reply"> {{:MyLang('retreat_title')}}</a>
			</legend>
			<div class="am-cf">
        		<div class="am-u-sm-6 am-padding-horizontal-0">
					<div class="am-form-group">
						<label>{{:MyLang('common_service.brand.form_item_name')}}<span class="am-form-group-label-tips-must">*</span></label>
						<input type="text" name="name" placeholder="{{:MyLang('common_service.brand.form_item_name_message')}}" minlength="2" maxlength="30" data-validation-message="{{:MyLang('common_service.brand.form_item_name_message')}}" class="am-radius" {{if !empty($data['name'])}} value="{{$data.name}}"{{/if}} required />
					</div>
				</div>
				<div class="am-u-sm-6 am-padding-horizontal-0">
					<div class="am-form-group">
						<label>{{:MyLang('common_service.brand.form_item_brand_category_id')}}<span class="am-form-group-label-tips-must">*</span></label>
					    <select name="brand_category_id" class="am-radius chosen-select" multiple="multiple" minchecked="1" data-placeholder="{{:MyLang('optional_tips')}}" data-validation-message="{{:MyLang('common_service.brand.form_item_brand_category_id_message')}}" required>
							{{foreach $brand_category as $v}}
								<option value="{{$v.id}}" {{if isset($data['brand_category_ids']) and is_array($data['brand_category_ids']) and in_array($v['id'], $data['brand_category_ids'])}}selected{{/if}}>{{$v.name}}</option>
							{{/foreach}}
						</select>
					</div>
				</div>
			</div>

			<div class="am-cf">
        		<div class="am-u-sm-6 am-padding-horizontal-0">
					<div class="am-form-group">
						<label>{{:MyLang('common_service.brand.form_item_website_url')}}</label>
						<input type="url" placeholder="{{:MyLang('common_service.brand.form_item_website_url_placeholder')}}" name="website_url"  data-validation-message="{{:MyLang('common_service.brand.form_item_website_url_message')}}" class="am-radius" {{if !empty($data['website_url'])}} value="{{$data.website_url}}"{{/if}} />
					</div>
				</div>
				<div class="am-u-sm-6 am-padding-horizontal-0">
					<div class="am-form-group">
						<label>{{:MyLang('common_service.brand.form_item_describe')}}</label>
						<textarea rows="1" name="describe" maxlength="230" class="am-radius" placeholder="{{:MyLang('common_service.brand.form_item_describe_message')}}" data-validation-message="{{:MyLang('common_service.brand.form_item_describe_message')}}">{{if !empty($data['describe'])}} {{$data.describe}}{{/if}}</textarea>
					</div>
				</div>
			</div>

			<div class="am-cf">
        		<div class="am-u-sm-6 am-padding-horizontal-0">
					<div class="am-form-group am-form-file">
						<label class="am-block">{{:MyLang('common_service.brand.form_item_logo')}}<span class="am-form-group-label-tips">{{:MyLang('common_service.brand.form_item_logo_tips')}}</span></label>
						<ul class="plug-file-upload-view brand-logo-images-view" data-form-name="logo" data-max-number="1" data-dialog-type="images">
							{{if !empty($data['logo'])}}
								<li>
									<input type="text" name="logo" value="{{$data.logo}}" />
									<img src="{{$data.logo}}" />
									<i>×</i>
								</li>
							{{/if}}
						</ul>
						<div class="plug-file-upload-submit" data-view-tag="ul.brand-logo-images-view">+ {{:MyLang('form_upload_images_title')}}</div>
					</div>
				</div>
				<div class="am-u-sm-6 am-padding-horizontal-0">
					<div class="am-cf">
        				<div class="am-u-md-6 am-padding-horizontal-0">
        					{{include file="lib/sort" /}}
        				</div>
        				<div class="am-u-md-6 am-padding-horizontal-0">
        					{{include file="lib/is_enable" /}}
        				</div>
        			</div>
				</div>
			</div>

			<!-- 插件扩展数据 start -->
			{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                <div class="plugins-tag">
                    <span>plugins_view_admin_brand_save</span>
                </div>
            {{/if}}
			{{if !empty($plugins_view_admin_brand_save_data) and is_array($plugins_view_admin_brand_save_data)}}
				<div class="am-alert am-alert-secondary">
					<label class="am-text-sm am-text-warning">{{:MyLang('plugins_view_region_config_tips')}}</label>
					<div>
						{{foreach $plugins_view_admin_brand_save_data as $hook}}
		                    {{if is_string($hook) or is_int($hook)}}
		                        {{$hook|raw}}
		                    {{/if}}
		                {{/foreach}}
					</div>
				</div>
			{{/if}}
			<!-- 插件扩展数据 end -->

			<div class="am-alert am-alert-secondary">
				{{include file="lib/seo" /}}
			</div>

			<div class="am-form-popup-submit">
				<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
				<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'{{:MyLang('processing_tips')}}'}">{{:MyLang('save_title')}}</button>
			</div>
		</form>
        <!-- form end -->
	</div>
</div>
<!-- right content end  -->

<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->